package reflection;

public class ReflectionTest1 {


    ReflectionTest1(String s) {
        System.out.println("reflectionTest1 无参构造方法");
    }
}

class ReflectionTest1_1 {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
        Class<?> c = Class.forName("reflection.ReflectionTest1");
        c.newInstance(); // reflectionTest1 无参构造方法
        // private的时候 java.lang.IllegalAccessException: Class reflection.ReflectionTest1_1 can not access a member of class reflection.ReflectionTest1 with modifiers "private"
        // 没有空的构造方法的时候 Caused by: java.lang.NoSuchMethodException: reflection.ReflectionTest1.<init>()
    }
}
